package com.springstart;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class Main {
	
	public static void main(String[] args) {
		Log log = LogFactory.getLog(Main.class);
		
		ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
		Student student1 = (Student)context.getBean("student1");
		System.out.println(student1.getId());
		System.out.println(student1.getName());
		System.out.println(student1.getSchool());
		Renderer renderer = context.getBean("renderer", Renderer.class);
		System.out.println(renderer.getProvider().getMessage());
		
		School school = (School)context.getBean("school");
		System.out.println(school.getStudent().getClist());
		System.out.println(School.class.isAssignableFrom(school.getClass()));
		
		Student childstudent = (Student)context.getBean("childstudent");
		System.out.println("child student:" + childstudent.getId() + "," + childstudent.getName());
		childstudent.setApplicationContext(context);
		System.out.println(childstudent.getContext());
//		Provider provider = context.getBean("provider", Provider.class);
//		System.out.println(provider.getMessage());
		 
		 PetOwner owner = (PetOwner)context.getBean("petowner");
		 System.out.println(owner.getPet());
		 
		 BuiltinEditor editor = (BuiltinEditor)context.getBean("propertyEditor");
		 System.out.println(editor.getClassName());
		 System.out.println(editor.getString());
		 System.out.println(editor.getStringList());
		 System.out.println(editor.getDog().getName());
	}
	

}
